package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;
import lombok.ToString;

/**
 * @ClassName LeaseException
 * @Author admin
 * @Date 2024/6/1
 */
@Data
@ToString
public class LeaseException extends RuntimeException {

    private Integer code;

    public LeaseException(String message,Integer code){
        super(message);
        this.code = code;
    }

    /**
     * 根据响应结果枚举对象创建异常对象
     * @param resultCodeEnum
     */
    public LeaseException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }


}
